Developer Documentation

QuickTime 4 API Documentation

QuickTime 4 Reference

| Previous | Chapter Contents | Chapter Top | Next |

Processing Standard Parameter Dialog Box Events

Once the dialog box has been created, you must process the events sent to it using an event loop. You repeatedly call WaitNextEvent and pass the events returned through the function "QTIsStandardParameterDialogEvent" .

The QTIsStandardParameterDialogEvent function checks each event to see if it relates to the standard parameters dialog box. You should continue to handle events that are not related to the standard parameters dialog box as usual.

Warning
You should not use the ModalDialog function to process events for a standard parameters dialog box. The ModalDialog function is not guaranteed to work correctly in all circumstances with a standard parameters dialog box.

You pass the event record returned from WaitNextEvent to the function QTIsStandardParameterDialogEvent , then check the return value to find out how the events was handled. Common return values are

noErr
The event was related to the standard parameters dialog box and was completely processed. Your application should not process this event, instead it should poll WaitNextEvent again.

featureUnsupported
The event was not related to the standard parameters dialog box. Your application should process the event in the normal way.

codecParameterDialogConfirm
The user clicked the OK button in the standard parameters dialog box. Your application should call QTDismissStandardParameterDialog to close the dialog box. The values chosen by the user are put into the atom container you passed in the parameters parameter when you called QTCreateStandardParameterDialog . This atom container now holds an effect description that is ready to insert into an effects track (it may require one or two kEffectSourceName atoms to be complete).

userCanceledErr
The user clicked the Cancel button in the standard parameters dialog box. Your application should call QTDismissStandardParameterDialog to close the dialog box.

The QTIsStandardParameterDialogEvent function may also return error codes, such as memory errors.

Your application should only process the event returned from WaitNextEvent if QTIsStandardParameterDialogEvent returns an error or featureUnsupported .

The code in Listing 5 is an example event loop showing how QTIsStandardParameterDialogEvent is used.

Listing 5 An example event loop showing use of QTIsStandardParameterDialogEvent

while (result == noErr)
{
    EventRecord     theEvent;

    WaitNextEvent(everyEvent, &theEvent, 0, nil);
    result = QTIsStandardParameterDialogEvent(&theEvent,
                                                createdDialogID);
    switch (result)
    {
        case featureUnsupported:
        {
            result = noErr;

            switch (theEvent.what)
            {
                case updateEvt:
                    BeginUpdate((WindowPtr) theEvent.message);
                    EndUpdate((WindowPtr) theEvent.message);
                    break;
            }
            break;
        }
        
        case codecParameterDialogConfirm:
        case userCanceledErr:
                QTDismissStandardParameterDialog(createdDialogID);
                createdDialogID = nil;
                break;
        }
    }
}

© 1999 Apple Computer, Inc.

| Previous | Chapter Contents | Chapter Top | Next |